﻿using FluentNHibernate.Mapping;
using HinduShop.Domain.Models;

namespace HinduShop.DbClassLib.Mappings
{
    public class ProductMap : ClassMap<Product>
    {
        public ProductMap()
        {
            Id(x => x.Id);
            Map(x => x.Name)
                .Nullable();
            References(x => x.Category);
            Map(x => x.Description);
            Map(x => x.Price);
            Map(x => x.ImageData);
            Map(x => x.ImageMimeType);
            HasManyToMany(x => x.Stores)
                .Cascade.All()
                .Table("StoreProduct");
        }
    }
}